//
//  ABTest.swift
//  SwiftCode
//
//  Created by yuhus on 2023/6/8.
//

import Foundation

/// AB 测试值的类型需实现此协议
public protocol ABValue {}

extension Int: ABValue {}
extension Bool: ABValue {}
extension String: ABValue {}

/// AB 测试环境
public enum ABTestEnviroment: String {
  case local
  case online
}

public protocol ABTestProvider {
  func getABValue<T>(key: String, default: T) -> T where T: ABValue
  func setABValue<T>(key: String, value: T) -> Bool where T: ABValue
}

public protocol ABTestConfigurationProtocol {
  /// ABTest 环境
  var environment: ABTestEnviroment { get set }
  
  var local: ABTestProvider { get }
  var online: ABTestProvider { get }
}
